From f2b39d8ae1082e6d2f364e5dab146d2396094cac Mon Sep 17 00:00:00 2001 From: "smh22@firebug.cl.cam.ac.uk" Date: Sun, 9 Oct 2005 20:55:53 +0100 Subject: [PATCH] Added some clarifying comments regarding xenbus/xenstore kernel startup. Signed-off-by: Steven Hand --- linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c | 5 ++++- .../drivers/xen/xenbus/xenbus_probe.c | 12 ++++++++++-- linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c | 4 ++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c index f3103092f1..6ed338bab1 100644 --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c @@ -246,7 +246,10 @@ static int privcmd_ioctl(struct inode *inode, struct file *file, PAGE_SHIFT); ret = xen_start_info->store_mfn; - /* We'll return then this will wait for daemon to answer */ + /* + ** Complete initialization of xenbus (viz. set up the + ** connection to xenstored now that it has started). + */ kthread_run(do_xenbus_probe, NULL, "xenbus_probe"); } break; diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c index a320bf36ae..5db856fe44 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c @@ -666,12 +666,16 @@ void unregister_xenstore_notifier(struct notifier_block *nb) } EXPORT_SYMBOL(unregister_xenstore_notifier); -/* called from a thread in privcmd/privcmd.c */ +/* +** Called either from below xenbus_probe_init() initcall (for domUs) +** or, for dom0, from a thread created in privcmd/privcmd.c (after +** the user-space tools have invoked initDomainStore()) +*/ int do_xenbus_probe(void *unused) { int err = 0; - /* Initialize xenstore comms unless already done. */ + /* Initialize the interface to xenstore. */ err = xs_init(); if (err) { printk("XENBUS: Error initializing xenstore comms:" @@ -703,6 +707,10 @@ static int __init xenbus_probe_init(void) device_register(&xenbus_frontend.dev); device_register(&xenbus_backend.dev); + /* + ** Domain0 doesn't have a store_evtchn yet - this will + ** be set up later by xend invoking initDomainStore() + */ if (!xen_start_info->store_evtchn) return 0; diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c index 8e52045853..ea0ead1596 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c @@ -780,6 +780,9 @@ static int read_thread(void *unused) } } +/* +** Initialize the interface to xenstore. +*/ int xs_init(void) { int err; @@ -793,6 +796,7 @@ int xs_init(void) init_MUTEX(&xs_state.transaction_mutex); xs_state.transaction_pid = -1; + /* Initialize the shared memory rings to talk to xenstored */ err = xb_init_comms(); if (err) return err; -- 2.30.2